package com.yun.algorithmproblem.leetcode;

public class Leetcode3396 {

	public static void main(String[] args) {
		Leetcode3396 obj=new Leetcode3396();
		System.out.println(obj.minimumOperations(new int[] {5,7,11,12,12}));
	}
	public int minimumOperations(int[] nums) {
		int[] cnt=new int[101];
		int start=0;
		int res=0;
		for (int num : nums) {
			cnt[num]++;
			while (cnt[num] > 1) {
				res++;
				for (int j = start; j < start + 3; j++) {
					if (j == nums.length - 1) {
						return res;
					}
					cnt[nums[j]]--;
				}
				start+=3;
			}
		}
		return res;
	}
}
